<!DOCTYPE html>

<html xmlns:th="http://www.thymeleaf.org">

<body>

<div th:fragment="nav" class="layui-header tree-bg-black">
    <div class="layui-container">
        <a class="tree-logo layui-hide-xs" href="/">
            <img src="/images/logo.png" alt="华农树洞" style="height: 40px;">
        </a>
        <a class="tree-logo layui-hide-lg layui-hide-md layui-hide-sm" href="/">
            <img src="/images/logo2.png" alt="华农树洞" style="height: 40px;">
        </a>
<!--        <ul class="layui-nav tree-nav layui-hide-xs">-->
<!--            <li class="layui-nav-item layui-this"><a href="/"><i class="layui-icon layui-icon-home"></i>主页</a></li>-->
<!--            &lt;!&ndash;li class="layui-nav-item"><a href="https://github.com/shaozihang/community"><i class="layui-icon layui-icon-fonts-code"></i>源码</a></&#45;&#45;li&ndash;&gt;-->
<!--        </ul>-->
        <ul class="layui-nav tree-nav-user">
            <li class="layui-nav-item" th:if="${session.user==null}"><a href="/login">登录</a></li>
            <li class="layui-nav-item" th:if="${session.user==null}"><a href="/register">注册</a></li>
            <!--登录后的状态-->
            <li class="layui-nav-item tree-hide-sm" style="margin-right: 20px" th:if="${session.user!=null}">
                <a href="/user/profile/message" th:if="${session.unreadCount>0}">有新消息
                    <span class="layui-badge" th:text="${session.unreadCount}"></span>
                </a>
            </li>
            <li class="layui-nav-item" th:if="${session.user!=null}">
                <a class="tree-nav-avatar niter-avatar" href="javascript:;">
                    <cite th:text="${session.user.nickName}"></cite>
                    <img th:src="${session.user.avatarUrl}">
                </a>
                <dl class="layui-nav-child tree-anim">
                    <dd style="top: 4px;"><a href="/user/profile/message">
                        <i class="layui-icon layui-icon-notice"></i>我的消息<span class="layui-badge-dot" th:if="${session.unreadCount>0}"></span></a>
                    </dd>
                    <dd><a th:href="${'/user/'+session.user.id}"><i class="layui-icon layui-icon-home"></i>我的主页</a></dd>
                    <hr style="margin: 5px 0;">
                    <dd><a href="/user/profile/questions"><i class="layui-icon layui-icon-tabs"></i>帖子管理</a></dd>
                    <dd><a href="/user/profile/bookMark"><i class="layui-icon layui-icon-rate"></i>收藏管理</a></dd>
                    <dd><a href="/user/set/account"><i class="layui-icon layui-icon-friends"></i>账户中心</a></dd>
                    <dd><a href="/user/set/info"><i class="layui-icon layui-icon-set-sm"></i>基本设置</a></dd>
                    <hr style="margin: 5px 0;">
                    <dd><a href="/logout" style="text-align: center;">退出</a></dd>
                </dl>
            </li>
        </ul>
    </div>
</div>
</body>
</html>
